import type { AxFiles } from '@/api/modules/ax/files/types';
import type { Rule } from 'ant-design-vue/es/form/interface';
// 切换表格页面和表单页面,如果需要个页面，可以用枚举实现
export const filesShowForm = ref(false);

const form: AxFiles = {
  fileId: 0,
  fileName: '',
  filePath: '',
  fileSize: '',
  fileType: '',
  fileDescription: '',
  createTime: null,
  updateTime: null,
  userId: 0,
  status: 0,
  fileStorageLocation: '',
  externalLink: '',
};

// 当前选中的一项，用于删除，编辑
export const filesForm = ref<AxFiles>({
  ...form,
});

// 重置表格
export const filesResetForm = () => {
  filesForm.value = {
    ...form,
  };
};

// 表格校验
export const filesRules: Record<string, Rule[]> = {
  fileName: [{ required: true, trigger: 'change' }],
  filePath: [{ required: true, trigger: 'blur' }],
  fileSize: [{ required: false, trigger: 'change' }],
  fileType: [{ required: false, trigger: 'change' }],
  fileDescription: [{ required: false, trigger: 'change' }],
};
